<%@page import="org.jeecgframework.web.util.StaticValue"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<div class="easyui-layout" fit="true">
	<div region="center" style="padding:1px;">
		<t:datagrid name="zyEquipmentSpareList" fitColumns="false" title="设备信息" actionUrl="zyEquipmentSpareController.do?datagrid&cmViewPageSn=${cmViewPageSn }" 
			idField="id" fit="true" queryMode="group" autoLoadData="false">
			<t:dgCol title="主键"			field="id"		hidden="true"	queryMode="single"  width="120"></t:dgCol>
			<t:dgCol title="设备SN"			field="sn"							queryMode="single"	query="true"	width="120"/>
			<t:dgCol title="机型"			field="type.typeDesc"				queryMode="single"	query="true"	width="120"/>
			<t:dgCol title="BP"				field="bpNo"						queryMode="single"	query="true"	width="100"/>
			<t:dgCol title="省市"			field="tsTerritoryVal"	width="80"	sortable="false" />
			<t:dgCol title="省市"			field="tsTerritory.territoryName"	hidden="true" queryMode="single"	sortable="false"	query="true"	width="80"	/>
			<t:dgCol title="所在影院名称"		field="zyCinema.name"  				queryMode="single"	query="true"	width="200"	/>
			<t:dgCol title="发货日期"		field="sendDate"    				queryMode="single"		width="90"		formatter="yyyy-MM-dd" />
			<t:dgCol title="安装日期"		field="installDate"					queryMode="group"	query="true"	width="90"		formatter="yyyy-MM-dd" />
			<t:dgCol title="销售保期"			field="repairDate"				queryMode="single"		width="80"		 />
			<t:dgCol title="保修截止日期"		field="repairEndDate"				queryMode="group"	query="true"	width="90"		formatter="yyyy-MM-dd" />
			<t:dgCol title="是否异常"		field="isNormal"					queryMode="single"	query="true"	width="60"		dictionary="<%=StaticValue.DIC_TRUE_OR_FALSE_NUM %>" />
			<t:dgCol title="设备服务状态"		field="serverState"					queryMode="single"	query="true"	width="100"		dictionary="<%=StaticValue.DIC_SERVER_STATE %>" />
			<t:dgCol title="激光改造"		field="laserReconstruction"			queryMode="single"	query="true"	width="70"		dictionary="<%=StaticValue.DIC_TRUE_OR_FALSE_NUM %>" defaultSelectVal="<%=StaticValue.DIC_TRUE_OR_FALSE_NUM_0 %>"/>
<%-- 			<t:dgCol title="续保方"			field="companyOfRenewal"				queryMode="single"		width="90"/> --%>
<%-- 			<t:dgCol title="保修开始日期"			field="warrantyBeginDate"				queryMode="single"		width="90" formatter="yyyy-MM-dd"/> --%>
 			<t:dgCol title="设备所属院线"			field="cinema"				queryMode="single"	query="true" 	width="120"/>
			<t:dgCol title="派单要求"			field="sendSign.shortname"			queryMode="single"		width="100" dictionary="t_s_depart,id,departname"/>
			<t:dgCol title="剩余巡检次数"			field="residualIpCount"				queryMode="single"		width="100"/>
			<t:dgCol title="Item"			field="item"				        queryMode="single"	width="100"/>
<%--			<t:dgCol title="去年巡检日期"		field="lastYearInspectionDate"		queryMode="single"	query="false"	width="120"		formatter="yyyy-MM-dd" ></t:dgCol>--%>
		   
			<t:dgToolBar title="录入" operationCode="EquipmentSpareAdd" icon="icon-add" url="zyEquipmentSpareController.do?goAdd" funname="add" width="940" height="450"></t:dgToolBar>
			<t:dgToolBar title="编辑" operationCode="EquipmentSpareEdit" icon="icon-edit" url="zyEquipmentSpareController.do?goUpdate" funname="update" width="960" height="450"></t:dgToolBar>
			<t:dgToolBar title="查看" operationCode="EquipmentSpareSearch" icon="icon-search" url="zyEquipmentSpareController.do?goView" funname="view" width="850" height="400"></t:dgToolBar>
			<t:dgToolBar title="导入" operationCode="EquipmentSparePut" icon="icon-put" funname="importExcel"></t:dgToolBar>
			<t:dgToolBar title="备件序列号查询" operationCode="EquipmentSpareSearch" icon="icon-search" funname="searchEquipment"></t:dgToolBar>
			<t:dgToolBar title="中影续保导入" operationCode="EquipmentSparePut" icon="icon-put" funname="importExcelByRenewal"></t:dgToolBar>
			<t:dgToolBar title="中影续保模板下载"  icon="icon-put" funname="ExportXlsByT"></t:dgToolBar>
		</t:datagrid>
	</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
	//给时间控件加上样式
	$("#zyEquipmentSpareListtb").find("input[name='installDate_begin']").attr({"class":"Wdate","id":"installDate_begin"}).click(function(){
		WdatePicker({dateFmt:'yyyy-MM-dd',maxDate:'#F{$dp.$D(\'installDate_end\')}'});
		});
	$("#zyEquipmentSpareListtb").find("input[name='installDate_end']").attr({"class":"Wdate","id":"installDate_end"}).click(function(){
		WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'#F{$dp.$D(\'installDate_begin\')}'});
		});
	$("#zyEquipmentSpareListtb").find("input[name='repairEndDate_begin']").attr({"class":"Wdate","id":"repairEndDate_begin"}).click(function(){
		WdatePicker({dateFmt:'yyyy-MM-dd',maxDate:'#F{$dp.$D(\'repairEndDate_end\')}'});
		});
	$("#zyEquipmentSpareListtb").find("input[name='repairEndDate_end']").attr({"class":"Wdate","id":"repairEndDate_end"}).click(function(){
		WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'#F{$dp.$D(\'repairEndDate_begin\')}'});
		});
	territoryLink("zyEquipmentSpareList","tsTerritory.territoryName");
	chooseBpForQueryParam("bpNo");
});
/**
 * 查看设备详细
 */
function view(){
	var datas = $("#zyEquipmentSpareList").datagrid("getSelections");
	if(datas.length != 1){
		tip("请选择一条查看的设备");
		return;
	}
	var id = datas[0].id;
	addOneTab("查看设备详细","zyEquipmentSpareController.do?goView&id="+id,"");
}

function importExcel(){
	createdetailwindow('设备数据导入', 'uploadEquipmentController.do?uploadFile',470,150);
}
/**
 * 中影续保导入
 */
function importExcelByRenewal(){
	createdetailwindow('中影续保导入', 'uploadEquipmentController.do?uploadFileByRenewal',470,150);
}

//模板下载
function ExportXlsByT() {
	JeecgExcelExport("zyEquipmentSpareController.do?exportXlsByT","zyEquipmentSpareList");
}
function aa(a,url){
	$.post(url);
}
//通过备件序列号查询
function searchEquipment(){
    openwindow('备件序列号查询', 'zyEquipmentSpareController.do?searchEquipment', '', 800, 300);
}
</script>